package gob.pe.mtpe.ibatis.implementacion;
import gob.pe.mtpe.ibatis.comun.BaseSqlMapDao;
import gob.pe.mtpe.ibatis.interfase.INTAjax;
import gob.pe.mtpe.struts.form.LoginForm;
import gob.pe.mtpe.util.funciones.Funciones;

import java.sql.SQLException;
import java.util.List;


import org.apache.log4j.Level;
import org.apache.log4j.Logger;

import com.ibatis.dao.client.DaoException;
import com.ibatis.dao.client.DaoManager;
import com.ibatis.sqlmap.client.SqlMapExecutor;

public class IMPAjax extends BaseSqlMapDao implements INTAjax{
    private SqlMapExecutor sqlMapExecutor;
    private static Logger depurador = Logger.getLogger(IMPAjax.class.getName());
    private Funciones funciones;
    
	public IMPAjax(DaoManager arg0){ super(arg0); }
	

	public LoginForm obtDatos(String ruc) throws DaoException {
            try{sqlMapExecutor  = getSqlMapExecutor();			
                return (LoginForm)sqlMapExecutor.queryForObject("obtDatos",ruc);                
		}catch(SQLException e){
		    funciones=new Funciones();
		    depurador.log(Level.ERROR,"ruc="+ruc);
		    depurador.log(Level.ERROR,funciones.readStackTrace(e));
		    throw new DaoException("");
		}
	}

	
public List obtCompAseguradora(String ruc) throws DaoException {
        try{sqlMapExecutor  = getSqlMapExecutor();
            return sqlMapExecutor.queryForList("obtCompAseguradora",ruc);	
	}catch(SQLException e){
	    funciones=new Funciones();
	    depurador.log(Level.ERROR,"ruc="+ruc);
	    depurador.log(Level.ERROR,funciones.readStackTrace(e));
	    throw new DaoException("");
	}
}

	

}
